// 拼接HTTPUrl
function url(pathname) {
  return window.RPConfig['local'] + pathname;
}

const ruleBaseAPI = {
  //1·规则维护--> 获取table列表接口
  querylist: params => {
    return $http.post(url('/rule/groupBpmn/page'), params).then(res => res.data);
  },

  //2·规则维护--> 下载模板接口
  downloadData: params => {
    return $http.get(url('/rule/bpmnImport/download'), params,'',{responseType: "blob" });
  },
  //3·规则维护-->导入/rule/bpmn/import
  importData: (params, path) => {
    return $http.post( url('/'+ path),params,null,{headers:{"Content-Type":"multipart/form-data"}})
  },
  //4·规则维护-->导出
  exportData: params => {
    return $http.post(url('/rule/bpmn/export'), params,'',{responseType: "blob" });
  },

  //5·规则维护--> 删除  //rule/groupBpmn/delete
  deleteData: params => {
    return $http.post(url('/rule/groupBpmn/delete'), params);
  },

  //6·规则维护--新建-->调接口生成编码
  buildCode: params => {
    return $http.post(url('/util/code/build'), params).then(res => res.data);
  },
  //规则维护--新建-->调接口生成ID主键//util/uuid/build
  buildId: params => {
    return $http.post(url('/util/uuid/build')).then(res => res.data);
  },

  //7·规则维护--新建form-->保存时调接口
  createList: params => {
    return $http.post(url('/rule/groupBpmn/add'), params).then(res => res.data);
  },
  //规则维护--新建form-->修改---保存时调接口修改
  updateList: params => {
    return $http.post(url('/rule/groupBpmn/update'), params).then(res => res.data);
  },

  //8· 规则维护--二级新建table-->保存时调接口  //rule/scriptBpmn/add
  createTable: params => {
    return $http.post(url('/rule/scriptBpmn/add'), params);
  },

  // 规则维护规则脚本-修改规则脚本//rule/scriptBpmn/update
  // 规则维护--二级新建table-->修改---保存时调接口  //rule/scriptBpmn/update
  updateTable: params => {
    return $http.post(url('/rule/scriptBpmn/update'), params);
  },

   //9·规则维护--二级详情页->获取当前行的table列表接口
  queryList1: params => {
    return $http.post(url('/rule/groupBpmn/list'), params).then(res => res.data);
  },
  //规则维护--三级详情页->获取当前行的table列表接口 //rule/scriptBpmn/list
  queryList2: params => {
    return $http.post(url('/rule/scriptBpmn/list'), params).then(res => res.data);
  },

  //10·规则维护--新建-->获取table列表接口 /rule/scriptBpmn/page
  queryDetails: params => {
    return $http.post(url('/rule/scriptBpmn/page'), params).then(res => res.data);
  },
  //规则维护--新建--> 删除  //rule/scriptBpmn/delete
  deleteDetails: params => {
    return $http.post(url('/rule/scriptBpmn/delete'), params);
  },
  //规则维护--提交form--->//rule/groupBpmn/submit
  submitList: params => {
    return $http.post(url('/rule/groupBpmn/submit'), params).then(res => res.data);
  },
  //批量创建规则脚本
  addScriptBpmnList: params => {
    return $http.post(url('/rule/scriptBpmn/addList'), params).then(res => res.data);
  },

  //外部引入Url
  detailPage(params, path) {
    return $http.get(url("/" + path), params).then(res => res.data)
  },
  // 获取当前用户信息详情 /sassp-service/purview/detail
  detailUserInfo:params => {
    return $http.get(url('/purview/detail'), params).then(res => res.data)
  },
}
export default ruleBaseAPI
